﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

public partial class index : System.Web.UI.Page
{
    //creamos el dataset que contendra las tablas
    DataSet ds = new DataSet();

    protected void Page_Load(object sender, EventArgs e)
    {
    }

    protected void btnimguser_Click(object sender, ImageClickEventArgs e)
    {
        if (txtuser.Text.Trim() != "")
        {
            Usuarios.Usuario us = new Usuarios.Usuario();
            ds = us.Login(txtuser.Text, txtclave.Text);
            DataTable Tus = ds.Tables["USUARIOS"];

            lblaviso.Visible = false;
            lblbien.Visible = true;



            if (ds.Tables["USUARIOS"].Rows.Count > 0)
            {
                string uxyz6, ngws, thkn;
                uxyz6 = Tus.Rows[0]["IDUSUARIO"].ToString().Trim();
                ngws = Tus.Rows[0]["NOMBRECOMPLETO"].ToString().Trim();
                thkn = Tus.Rows[0]["TIPO"].ToString().Trim();
                lblbien.Text = "BienVenido " + ngws;
                Session["iduser"] = uxyz6;
                Session["Ncom"] = ngws;
                if (thkn == "Candidato")
                {
                    Response.Redirect("Candidato.aspx");

                }
                else if (thkn == "Empresa")
                {
                    Response.Redirect("Empresa.aspx");
                }
                else if (thkn == "Outsourcing")
                {
                    Response.Redirect("OutSourcing.aspx");
                }
            }
            else
            {
                lblaviso.Visible = true;
                lblbien.Visible = false;

            }

        }
        else
        {
            lblaviso.Visible = true;
            lblbien.Visible = false;
        }

    }   

    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        Session.Clear();
        Session.Abandon();

    }
    protected void LinkButton2_Click(object sender, EventArgs e)
    {
        Session.Clear();
        Session.Abandon();


    }

}